"""this script parse the content of a xml file"""
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QWidget
from app.main_logic.main_logic import MainLogic


class MainFun(QWidget):
    """ Summary of class here...
        主函数类
    """

    def __init__(self):
        """
        检测流程初始化
        """
        super(MainFun, self).__init__()

        self.main_logic = MainLogic()
        self.main_logic.start()

        self.main_dialog = self.main_logic.signal.main_dialog
        self.init_main_dialog = self.main_logic.signal.init_main_dialog

        #按键的点击事件
        self.setting_click_connect()

    def setting_click_connect(self):
        """
        按钮连接事件
        :param :None
        :return:None
        """
        self.main_dialog.calc_button.clicked.connect(self.__star_calc)

    def __star_calc(self):
        """
        开始计算
        :param :None
        :return:None
        """
        self.main_logic.start_calc = True
        self.main_logic.zh_refer = float(self.main_dialog.zh_refer.text())
        self.main_logic.xd_price = float(self.main_dialog.xd_price.text())


if __name__ == '__main__':
    APP = QtWidgets.QApplication(sys.argv)
    UI = MainFun()
    sys.exit(APP.exec_())
